/*/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gardenmaker;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import java.awt.geom.Rectangle2D.Double;

/**
 *
 * @author lenny
 */
public class Fonte extends Forma {
    
    Image img;
    Double rect;
    
    public Fonte(int x, int y, String name) {
        super(x, y, name);

        altura = 32;
        largura = 32;
        jprop.setTHeight(altura);
        jprop.setTWidth(largura);
        
        this.name= name;
        img = Toolkit.getDefaultToolkit().getImage("./src/fountain.png");
        rect = new Rectangle2D.Double(x, y, largura, altura);
        formaArea = new Area(rect);
    }
    
    @Override
    public void setAltura(int a) {
        altura = a;
     
        rect = new Rectangle2D.Double(x, y, largura, altura);
        formaArea = new Area(rect);
        selectionSquare();
    }
    
    @Override
    public void setLargura(int l) {
        largura = l;

        rect = new Rectangle2D.Double(x, y, largura, altura);
        formaArea = new Area(rect);
        selectionSquare();
    }
    
    @Override
    public void setXY(int x, int y) {
        this.x = x;
        this.y = y;
        Double rect = new Rectangle2D.Double(this.x, this.y, largura, altura);
        formaArea = new Area(rect);
        selectionSquare();
    }
    
    
     @Override
    public void desenhar(Graphics g){
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor (Color.BLACK);
        g2.drawImage(img, x, y, largura, altura, null);
        
    }
     
     @Override
    public void desenharSelBox(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        selectionSquare();
        g2.setColor(Color.GREEN);
        g2.draw(selBox);
        g2.setColor(Color.BLACK);
    }
     
    @Override
    public Area getArea(){
        return formaArea;
    }
     
      @Override
    public void setArea(Area ar){
       this.formaArea=ar; 
    }
    
}
